<template>
  <div>
    <h1>parent</h1>
    <m-child msg="from parent message" @showMsg="showMsg" ref="child" v-bind="$attrs" v-on="$listeners"></m-child>
    <h4>{{ msg }}</h4>
  </div>
</template>

<script>
import MChild from "./Child.vue";
export default {
  components: {
    MChild,
  },
  data() {
    return {
      msg: "",
      parentData:'这里是父组件的data'
    };
  },
  methods: {
    showMsg(val) {
      this.msg = val;
    },
  },
  mounted () {
    // console.log(this.$children[0].childMsg);
    console.log(this.$refs.child.childMsg);
  },
};
</script>

<style></style>
